from django.db import models
from django.utils.translation import gettext_lazy as _
from django.contrib.auth import get_user_model
# from django.contrib.auth.models import User

User = get_user_model()

STATUS_CHOICES = {
    ('1', _('上架')),
    ('2', _('下架')),
}


class TestTable(models.Model):
    id = models.BigIntegerField(verbose_name=_('Id'), db_index=True, primary_key=True)
    name = models.CharField(verbose_name=_('Name'), max_length=100)
    author = models.ForeignKey(User, verbose_name=_('Author'), on_delete=models.CASCADE, related_name='Articles')
    content = models.TextField(verbose_name=_('Content'), blank=True)
    status = models.IntegerField(verbose_name=_('Status'), choices=STATUS_CHOICES)
    create_date = models.DateTimeField(verbose_name=_('Create Date'), auto_now_add=True)

    def __str__(self):
        return self.name

